-
Notifications
You must be signed in to change notification settings - Fork 176
perf: avoid unnecessary buffer copy in internalWrite #1013
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf: avoid unnecessary buffer copy in internalWrite #1013
Conversation
🦋 Changeset detectedLatest commit: e03b871 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
See the code comments for details.
a428ff3
to
a7173ff
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add more info about "buffer" encoding.
It does not seem to be supported on Node 22.16.0 (see inline comment)
Thanks for the additional details @jasnell. IIUC the first change makes sense to avoid having to copy the buffer when it is already a buffer. Still not clear about
Can you measure any perf difference for that second change? |
'buffer' is a legit encoding
value in _transform
.
Does not seem to affect push
and documented as not supported.
See the code comments for details.
One challenge/question: it's not clear that this function is actually being tested with
pnpm run test
... to check I added athrow new Error('boom')
and ranpnpm run test
and everything still passed./cc @vicb @anonrig